home *** CD-ROM | disk | FTP | other *** search
- /* pipe.c -- A portable implementation of a simple pipe
- * mechanism.
- *
- * (c) 1997 Brian Connors. This code may be used for any
- * purpose, by anyone, as long as you make available a
- * copy of or equivalent cash value to the final product.
- */
-
- #include <stdio.h>
- #include <string.h>
- #include "pipe.h"
-
- /* popen: opens a pipe named fn as mode. The pipe is actually
- * just an ordinary file. If you pass in a null string, it
- * looks around for a file called "stdout".
- */
-
- FILE *popen(const char *fn, const char *mode) {
- FILE *pf;
-
- if (!fn) {
- pf = fopen("stdout", mode);
- } else {
- pf = fopen(fn, mode);
- }
-
- return pf;
- }
-
- int pclose(FILE *pf) {
- return fclose(pf);
- }
-